package com.gopay.common.riskcontrol.dao.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.domain.riskcontrol.RcSysRule;
import com.gopay.common.riskcontrol.dao.RcSysRuleQueryDAO;

/**
 * RcSysRuleQuery DAO接口实现
 * 
 * RcSysRuleQueryDAOImpl.java
 * @author zhuliang
 * @2016-1-18 上午11:41:01 www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("rcSysRuleQueryDAO")
public class RcSysRuleQueryDAOImpl extends BaseDAOImpl<RcSysRule, Serializable> implements RcSysRuleQueryDAO{

	@Override
    public RcSysRule getByCode(String code){
		DetachedCriteria criteria = DetachedCriteria.forClass(RcSysRule.class);

		criteria.add(Restrictions.eq("code", code));
		List<RcSysRule> result = findByCriteria(criteria);

		return result == null ? null : result.get(0) ;
	}

}
